package ${packageName};

import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.support.mybatis.annotation.MyBatisRepository;

import ${MODEL_URL};
import org.support.page.Paging;


/**
 * @author ${annotation.authorName}<br>
 * @date ${annotation.date}
 * 
 * @version ${annotation.version}
 */
@MyBatisRepository
public interface ${classPrefix}${className}${classSuffix} {  

   <#list colList as col>
    <#if col.isPK==1>
     /**
     *
     * 插入数据
	 * @author ${annotation.authorName}
     * @param ${classNameLower}
     * @return 影响数
     **/
    public int save(${className} ${classNameLower});
    </#if>
    </#list>
    
    
   <#list colList as col>
    <#if col.isPK==1>
    /**
     * 删除通过主键
	 * @author ${annotation.authorName}
     * @param ${col.columnName} ${col.remarks}
     * @return 影响数
     **/
    public int deleteByPrimaryKey(@Param("${col.columnName}")${col.simpleFieldType} ${col.columnName});
    </#if>
    </#list>
    
    
    <#list colList as col>
    <#if col.isPK==1>
    /**
     * 更新不为空的字段通过主键
	 * @author ${annotation.authorName}
     * @param ${classNameLower}
     * @return 影响数
     **/
    public int updateByPrimaryKey(${className} ${classNameLower});
    </#if>
    </#list>
    
    <#list colList as col>
    <#if col.isPK==1>
    /**
     * 查询通过主键
	 * @author ${annotation.authorName}
     * @param ${col.columnName} ${col.remarks}
     * @return 影响数
     **/
    public ${className} selectByPrimaryKey(@Param("${col.columnName}")${col.simpleFieldType} ${col.columnName});
    </#if>
    </#list>
    
    
    /**
     *
     * 查找所有
     * @author ${annotation.authorName}
     * @return
     **/
    public List<${className}> query${className}All();

    /**
     * 统计分页数据
     * @author ${annotation.authorName}
     * @param ${classNameLower}
     * @return
     */
    public Integer countByPage(@Param("param") ${className} ${classNameLower},@Param("page")Paging page);


    /**
     * 查询通过分页
     *
     * @param page
     * @return
     * @author ${annotation.authorName}
     */
    public List<${className}> queryByPage(@Param("param") ${className} ${classNameLower},@Param("page")Paging page);


    <#list colList as col>
        <#if col_has_next>
           <#if col.db_column == "is_deleted">
    /**
     * 修改删除状态
     *
     * @param id
     * @param isDeleted
     * @return
     */
    public Integer modifyDeleteStatus(@Param("id") Integer id, @Param("isDeleted") Integer isDeleted, @Param("curDate") Date curDate);
           </#if>
        </#if>
    </#list>

    /**
     * 查询通过ID集合
     *
     * @param itemList
     * @return
     * @author 66
     */
    public List<${className}> queryByIdList(@Param("itemList") List<Integer> itemList);
    
    <#list idxList as idx>
	/**
     * 根据索引查询
     * @author ${annotation.authorName}
     <#list idx.colList as idxCol>
     * @param  ${idxCol.columnName} ${idxCol.remarks}
     </#list>
     * @return 集合
     **/
    public List<${className}> query${className}By${idx.idxName}(<#list idx.colList as idxCol><#if idxCol_has_next>@Param("${idxCol.columnName}")${idxCol.simpleFieldType} ${idxCol.columnName},<#else>@Param("${idxCol.columnName}")${idxCol.simpleFieldType} ${idxCol.columnName}</#if></#list>);
	</#list>
	

}
